//
//  ScrollViewController.swift
//  test
//
//  Created by colin on 2019/3/31.
//  Copyright © 2019 colin. All rights reserved.
//

import UIKit

class ScrollViewController: CLBaseViewController {

    var scrollHandle:((_ index:Int, _ scrollView:UIScrollView)->Void)?
    var endDecelerating:((_ index:Int, _ scrollView:UIScrollView)->Void)?
    
    var index = 0
    
    func scrollView() -> UIScrollView? {
        return nil
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // 设置内容最小高度
        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
            if let scrollView = self?.scrollView(), let container = self?.view {
                let containerHeight = container.frame.height - 44.0
                var contentSize = scrollView.contentSize
                if contentSize.height < containerHeight {
                    contentSize.height = containerHeight
                    scrollView.contentSize = contentSize
                }
            }
        }
    }
    
}
